package com.xuxin.nantai.fragment;

import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.xuxin.nantai.R;
import com.xuxin.nantai.base.BaseFragment;
import com.xuxin.nantai.bean.BaseBean;
import com.xuxin.nantai.contract.MainContract;
import com.xuxin.nantai.presenter.MainPresenter;

public class MainFragment extends BaseFragment implements MainContract.View {
    private MainContract.Presenter presenter = new MainPresenter(this);

    public static MainFragment newInstance() {
        return new MainFragment();
    }

    @Override
    public View setContentView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container) {
        return inflater.inflate(R.layout.fragment_main, container, false);
    }

    @Override
    public void initView() {
    }

    @Override
    public void initData() {
        handler.sendEmptyMessage(1);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
        }
    }

    private Handler handler = new Handler(new Handler.Callback() {
        @Override
        public boolean handleMessage(Message message) {
            switch (message.what) {
                case 0:
                    presenter.getData();
                    break;
                case 1:
                    break;
            }
            return false;
        }
    });

    @Override
    public void onSuccess(BaseBean mainBean) {
    }


    @Override
    public void onComplete() {

    }
}